package com.ycrlkj.android.modulescore.main.viewmodel;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class FreightOrderFormViewModel extends ViewModel {

    public MutableLiveData<Integer> consignmentDistance;

    public MutableLiveData<Integer> getConsignmentDistance() {
        if (consignmentDistance == null) {
            consignmentDistance = new MutableLiveData<>();
            consignmentDistance.setValue(0);
        }
        return consignmentDistance;
    }

    public MutableLiveData<String> driverTime;

    public MutableLiveData<String> getDriverTime() {
        if (driverTime == null) {
            driverTime = new MutableLiveData<>();
            driverTime.setValue("");
        }
        return driverTime;
    }

    public MutableLiveData<String> remarks;

    public MutableLiveData<String> getRemarks() {
        if (remarks == null) {
            remarks = new MutableLiveData<>();
            remarks.setValue("");
        }
        return remarks;
    }

    public MutableLiveData<String> predictPriceText;

    public MutableLiveData<String> getPredictPriceText() {
        if (predictPriceText == null) {
            predictPriceText = new MutableLiveData<>();
            predictPriceText.setValue("");
        }
        return predictPriceText;
    }

    public MutableLiveData<String> consigneePhone;

    public MutableLiveData<String> getConsigneePhone() {
        if (consigneePhone == null) {
            consigneePhone = new MutableLiveData<>();
            consigneePhone.setValue("");
        }
        return consigneePhone;
    }

    public MutableLiveData<String> startAddress;

    public MutableLiveData<String> getStartAddress() {
        if (startAddress == null) {
            startAddress = new MutableLiveData<>();
            startAddress.setValue("");
        }
        return startAddress;
    }

    public MutableLiveData<String> endAddress;

    public MutableLiveData<String> getEndAddress() {
        if (endAddress == null) {
            endAddress = new MutableLiveData<>();
            endAddress.setValue("");
        }
        return endAddress;
    }

    public MutableLiveData<String> goodsCountText;

    public  MutableLiveData<String> getGoodsCountText(){
        if (goodsCountText == null) {
            goodsCountText = new MutableLiveData<>();
            goodsCountText.setValue("");
        }
        return goodsCountText;
    }

    public MutableLiveData<Integer> isXx;

    public MutableLiveData<Integer> getIsXx() {
        if (isXx == null) {
            isXx = new MutableLiveData<>();
            isXx.setValue(1);
        }
        return isXx;
    }


    /* #region ========================= 交货时间 开始 ====================== */
    public MutableLiveData<String[]> deliveryTimeArr;
    public MutableLiveData<String> deliveryTime;
    public MutableLiveData<Integer> deliveryTimePosition;

    public MutableLiveData<String[]> getDeliveryTimeArr() {
        if (deliveryTimeArr == null) {
            deliveryTimeArr = new MutableLiveData<>();

            String[] dateArr = new String[11];

            SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
            Calendar calendar = new GregorianCalendar();

            Date todayDate = new Date();
            calendar.setTime(todayDate);

            for (int i = 0; i < 11; i++) {
                if(i == 0){
                    dateArr[i] = "无";
                }else{
                    calendar.add(Calendar.DATE, 1);
                    dateArr[i] = sd.format(calendar.getTime());
                }
            }

            deliveryTimeArr.setValue(dateArr);
        }
        return deliveryTimeArr;
    }

    public MutableLiveData<String> getDeliveryTime() {
        if (deliveryTime == null) {
            deliveryTime = new MutableLiveData<>();
            deliveryTime.setValue("");
        }
        return deliveryTime;
    }

    public MutableLiveData<Integer> getDeliveryTimePosition() {
        if (deliveryTimePosition == null) {
            deliveryTimePosition = new MutableLiveData<>();
            deliveryTimePosition.setValue(0);
        }
        return deliveryTimePosition;
    }
    /* #endregion ====================== 交货时间 结束 ====================== */


    /* #region ========================= 货物数量单位 开始 ====================== */
    public MutableLiveData<int[]> goodsCountUnitValueArr;
    public MutableLiveData<String[]> goodsCountUnitTextArr;
    public MutableLiveData<Integer> goodsCountUnitPosition;
    public MutableLiveData<String> goodsCountUnitText;

    public MutableLiveData<int[]> getGoodsCountUnitValueArr() {
        if (goodsCountUnitValueArr == null) {
            goodsCountUnitValueArr = new MutableLiveData<>();
            goodsCountUnitValueArr.setValue(new int[0]);
        }
        return goodsCountUnitValueArr;
    }
    public MutableLiveData<String[]> getGoodsCountUnitTextArr() {
        if (goodsCountUnitTextArr == null) {
            goodsCountUnitTextArr = new MutableLiveData<>();
            goodsCountUnitTextArr.setValue(new String[0]);
        }
        return goodsCountUnitTextArr;
    }
    public MutableLiveData<Integer> getGoodsCountUnitPosition() {
        if (goodsCountUnitPosition == null) {
            goodsCountUnitPosition = new MutableLiveData<>();
            goodsCountUnitPosition.setValue(0);
        }
        return goodsCountUnitPosition;
    }
    public MutableLiveData<String> getGoodsCountUnitText() {
        if (goodsCountUnitText == null) {
            goodsCountUnitText = new MutableLiveData<>();
            goodsCountUnitText.setValue("");
        }
        return goodsCountUnitText;
    }
    /* #endregion ====================== 货物数量单位 结束 ====================== */


    /* #region ========================= 车辆规格 开始 ====================== */
    public MutableLiveData<int[]> vehicleSpecificationValueArr;
    public MutableLiveData<String[]> vehicleSpecificationTextArr;
    public MutableLiveData<Integer> vehicleSpecificationPosition;
    public MutableLiveData<String> vehicleSpecificationText;

    public MutableLiveData<int[]> getVehicleSpecificationValueArr() {
        if (vehicleSpecificationValueArr == null) {
            vehicleSpecificationValueArr = new MutableLiveData<>();
            vehicleSpecificationValueArr.setValue(new int[0]);
        }
        return vehicleSpecificationValueArr;
    }
    public MutableLiveData<String[]> getVehicleSpecificationTextArr() {
        if (vehicleSpecificationTextArr == null) {
            vehicleSpecificationTextArr = new MutableLiveData<>();
            vehicleSpecificationTextArr.setValue(new String[0]);
        }
        return vehicleSpecificationTextArr;
    }
    public MutableLiveData<Integer> getVehicleSpecificationPosition() {
        if (vehicleSpecificationPosition == null) {
            vehicleSpecificationPosition = new MutableLiveData<>();
            vehicleSpecificationPosition.setValue(0);
        }
        return vehicleSpecificationPosition;
    }
    public MutableLiveData<String> getVehicleSpecificationText() {
        if (vehicleSpecificationText == null) {
            vehicleSpecificationText = new MutableLiveData<>();
            vehicleSpecificationText.setValue("");
        }
        return vehicleSpecificationText;
    }
    /* #endregion ====================== 车辆规格 结束 ====================== */


    /* #region ========================= 货物组 开始 ====================== */
    public MutableLiveData<String[]> goodsTypeModuleIdArr;
    public MutableLiveData<String[]> goodsTypeModuleNameArr;
    public MutableLiveData<Integer> goodsTypeModulePosition;
    public MutableLiveData<String> goodsTypeModuleText;

    public MutableLiveData<String[]> getGoodsTypeModuleIdArr() {
        if (goodsTypeModuleIdArr == null) {
            goodsTypeModuleIdArr = new MutableLiveData<>();
            goodsTypeModuleIdArr.setValue(new String[0]);
        }
        return goodsTypeModuleIdArr;
    }

    public MutableLiveData<String[]> getGoodsTypeModuleNameArr() {
        if (goodsTypeModuleNameArr == null) {
            goodsTypeModuleNameArr = new MutableLiveData<>();
            goodsTypeModuleNameArr.setValue(new String[0]);
        }
        return goodsTypeModuleNameArr;
    }

    public MutableLiveData<Integer> getGoodsTypeModulePosition() {
        if (goodsTypeModulePosition == null) {
            goodsTypeModulePosition = new MutableLiveData<>();
            goodsTypeModulePosition.setValue(0);
        }
        return goodsTypeModulePosition;
    }
    public MutableLiveData<String> getGoodsTypeModuleText() {
        if (goodsTypeModuleText == null) {
            goodsTypeModuleText = new MutableLiveData<>();
            goodsTypeModuleText.setValue("");
        }
        return goodsTypeModuleText;
    }
    /* #endregion ====================== 货物组 结束 ====================== */


    /* #region ========================= 货物类型 开始 ====================== */
    public MutableLiveData<String[]> goodsTypeItemIdArr;
    public MutableLiveData<String[]> goodsTypeItemNameArr;
    public MutableLiveData<Integer> goodsTypeItemPosition;
    public MutableLiveData<String> goodsTypeItemText;

    public MutableLiveData<String[]> getGoodsTypeItemIdArr() {
        if (goodsTypeItemIdArr == null) {
            goodsTypeItemIdArr = new MutableLiveData<>();
            goodsTypeItemIdArr.setValue(new String[0]);
        }
        return goodsTypeItemIdArr;
    }

    public MutableLiveData<String[]> getGoodsTypeItemNameArr() {
        if (goodsTypeItemNameArr == null) {
            goodsTypeItemNameArr = new MutableLiveData<>();
            goodsTypeItemNameArr.setValue(new String[0]);
        }
        return goodsTypeItemNameArr;
    }

    public MutableLiveData<Integer> getGoodsTypeItemPosition() {
        if (goodsTypeItemPosition == null) {
            goodsTypeItemPosition = new MutableLiveData<>();
            goodsTypeItemPosition.setValue(0);
        }
        return goodsTypeItemPosition;
    }
    public MutableLiveData<String> getGoodsTypeItemText() {
        if (goodsTypeItemText == null) {
            goodsTypeItemText = new MutableLiveData<>();
            goodsTypeItemText.setValue("");
        }
        return goodsTypeItemText;
    }
    /* #endregion ====================== 货物类型 结束 ====================== */


}
